package ex2.SearchingAndSorting;

public class Sorting <T extends Comparable<T>>{
    public static <T extends Comparable<? super T>> void selectionSort(T[] data)
    {
        int min;
        T temp;

        for (int index = 0; index < data.length-1; index++)
        {
            min = index;
            for (int scan = index+1; scan < data.length; scan++)
                if (data[scan].compareTo(data[min])<0)
                    min = scan;

            //swap(data, min, index);
            temp = data[min];
            data[min] = data[index];
            data[index] = temp;

        }
    }
}
